package com.invengo.library_db.entity.module_check;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;
import org.greenrobot.greendao.annotation.Keep;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;

import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;

import com.invengo.library_db.dao.DaoSession;
import com.invengo.library_db.dao.ShelfBeanDao;
import com.invengo.library_db.dao.ColumBeanDao;

@Entity
public class ColumBean {
    @Id(autoincrement = true)
    private Long Id;
    @Index
    private String roomName;
    @Index
    private String floorName;
    @Index
    private String buildingName;
    @Index
    private String columName;

    private int columNum;
    private String columSortName;

    @ToMany(referencedJoinProperty = "columName")
    private List<ShelfBean> shelfBeans;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1257897241)
    private transient ColumBeanDao myDao;

    @Generated(hash = 1117502618)
    public ColumBean(Long Id, String roomName, String floorName,
            String buildingName, String columName, int columNum,
            String columSortName) {
        this.Id = Id;
        this.roomName = roomName;
        this.floorName = floorName;
        this.buildingName = buildingName;
        this.columName = columName;
        this.columNum = columNum;
        this.columSortName = columSortName;
    }

    @Generated(hash = 1058362769)
    public ColumBean() {
    }

    public Long getId() {
        return this.Id;
    }

    public void setId(Long Id) {
        this.Id = Id;
    }

    public String getRoomName() {
        return this.roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public String getFloorName() {
        return this.floorName;
    }

    public void setFloorName(String floorName) {
        this.floorName = floorName;
    }

    public String getBuildingName() {
        return this.buildingName;
    }

    public void setBuildingName(String buildingName) {
        this.buildingName = buildingName;
    }

    public String getColumName() {
        return this.columName;
    }

    public void setColumName(String columName) {
        this.columName = columName;
    }

    public int getColumNum() {
        return this.columNum;
    }

    public void setColumNum(int columNum) {
        this.columNum = columNum;
    }

    public String getColumSortName() {
        return this.columSortName;
    }

    public void setColumSortName(String columSortName) {
        this.columSortName = columSortName;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
  @Keep
    public List<ShelfBean> getShelfBeans() {
        if (shelfBeans == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ShelfBeanDao targetDao = daoSession.getShelfBeanDao();
            List<ShelfBean> shelfBeansNew = targetDao
                    ._queryColumBean_ShelfBeans(columName);
            synchronized (this) {
                if (shelfBeans == null) {
                    shelfBeans = shelfBeansNew;
                }
            }
        }
        return shelfBeans;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 2068132870)
    public synchronized void resetShelfBeans() {
        shelfBeans = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1090676682)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getColumBeanDao() : null;
    }


}
